﻿<controls:ChildWindow x:Class="AuroraPlatform.View.UserManager.UserListWindow"
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
           xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
           xmlns:local="clr-namespace:AuroraPlatform.View.UserManager"
           xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
           xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"    
           xmlns:coverter="clr-namespace:AuroraPlatform"
           Width="450" Height="500" Title="用户管理" FontSize="13" FontFamily="Arial,Microsoft YaHei,NSimSun,SimHei" Language="zh-CN">
    <controls:ChildWindow.Resources>
        <local:RoleConverter x:Key="RoleTypeConverter"/>
        <coverter:SystemUserConverter x:Key="SystemUserConverter"/>
    </controls:ChildWindow.Resources>
    <toolkit:BusyIndicator Margin="2" Name="busy"  BusyContent="正在加载用户信息，请稍等......">
        <Grid x:Name="LayoutRoot">
            <Grid.RowDefinitions>
                <RowDefinition Height="30"></RowDefinition>
                <RowDefinition Height="*"></RowDefinition>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <Button Width="95" Height="23" x:Name="AddUserBtn" VerticalAlignment="Center" HorizontalAlignment="Left">
                <StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left">
                    <Image Source="Images/Add.png" Width="14" Height="14" VerticalAlignment="Center"/>
                    <TextBlock Text="新增用户" Margin="5,0,0,0" VerticalAlignment="Center"/>
                </StackPanel>
            </Button>
            <sdk:DataGrid Margin="0,5,0,0" AutoGenerateColumns="False" Grid.Row="1" HorizontalAlignment="Stretch" Name="dataGrid1" VerticalAlignment="Stretch"  IsReadOnly="True">
                <sdk:DataGrid.Columns>
                    <sdk:DataGridTextColumn Width="120" Header="用户" Binding="{Binding Name}"/>
                    <sdk:DataGridTextColumn  Width="120" Header="角色" Binding="{Binding RoleType, Converter={StaticResource RoleTypeConverter}}"/>
                    <sdk:DataGridTemplateColumn Header="用户操作" Width="*">
                        <sdk:DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <StackPanel Visibility="{Binding Name, Converter={StaticResource SystemUserConverter}}" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
                                    <Button Click="Modify_Click" Style="{StaticResource TransparentButton}">
                                        <Image Source="/AuroraPlatform;component/Images/modify.png" Stretch="None" Width="16" Height="16" ></Image>
                                    </Button>
                                    <Button Click="Delete_Click" Style="{StaticResource TransparentButton}" Margin="10, 0, 0, 0">
                                        <Image Source="/AuroraPlatform;component/Images/del.png" Stretch="None"  Width="16" Height="16"></Image>
                                    </Button>
                                </StackPanel>
                            </DataTemplate>
                        </sdk:DataGridTemplateColumn.CellTemplate>
                    </sdk:DataGridTemplateColumn>
                </sdk:DataGrid.Columns>
            </sdk:DataGrid>

            <Button x:Name="CancelButton" Content="关闭" Click="CancelButton_Click" Width="75" Height="23" HorizontalAlignment="Right" Margin="0,12,0,0" Grid.Row="2" />
        </Grid>
    </toolkit:BusyIndicator>
</controls:ChildWindow>